package sol.leetcode;

/**
 * Unique Paths
 */
public class Issue062 {
    public int uniquePaths(int m, int n) {
        int[][] store = new int[m][n];
        for (int i = 0; i < m; ++i) {
            for (int j = 0; j < n; ++j) {
                if (i == 0 || j == 0) store[i][j] = 1;
                else store[i][j] = store[i][j - 1] + store[i - 1][j];
            }
        }
        return store[m - 1][n - 1];
    }

    public static void main(String[] args) {
        System.out.println(new Issue062().uniquePaths(3, 4));
    }
}
